module.exports = function(path, data, method){
  return new Promise((resolve, reject) => {
    wx.request({
      url: 'http://127.0.0.1:8081/api/' + path,   //接口地址
      method: method,   //请求参数
      data: data,       //参数
      header: {         //请求头
        'Content-Type': 'Json'
      },
      success: resolve,
      //请求失败执行fail操作
      fail: function(){
        reject()
        wx.showModal({
          showCancel: false,
          title: '失败'
        })
      }
    })
  })
}